<template>
	<view class="content">
		
		<view class="btn" >
			
			<div style="margin-top: 30px;">
			<button type="default" @click="scan" style="margin-bottom: 20px;">点击扫描钢瓶</button>
			</div>
			<u-gap height="30"></u-gap>
			<button type="default"  style="margin-bottom: 20px;"  @click="back">返回</button>
		</view>
		<!-- <view class="admin">
			<view>{{msg}}</view>
		</view> -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				msg: "",
				q:"",
				user:[],
			}
		},
		methods: {
			
			back(){
				uni.switchTab({
									url: '/pages/sys/workbench/index'
								});
			},

      scan() {
				uni.scanCode({
					success: (res) => {
            // 适配小程序码  20240531
            if (typeof res.path !== "undefined" && res.path !== null && res.path !== '') {
              // 参数不为空,拼接并跳转
              console.log("res:")
              console.log(res.path)
              let id_code = res.path.split('=')[1]
              console.log(id_code)
              let url_new = "/pages/sys/workbench/add-form1?id=" + id_code
              uni.redirectTo({
                url: url_new,
              })
            }else{
              // 正常走逻辑,系统生成的普通二维码
              var u = ""
              this.msg = res.result

              this.$u.api.user1.encodeUser({
                text:this.msg,
              }).then(response => {
                this.user = response.data;
                console.log(this.user+"779")
                uni.redirectTo({
                  url: this.user+"",
                })
              });
            }// else end
						
					},
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
@import 'index.scss';
page {
	background-color: #f5f5f5;
}
.wrap .search{
	background: #ffffff;
}
.apply-text{
	font-size: 28rpx;
	color: #333333;
	span{
		color: #999999;
	}
}
.user-images{
	width: 28px;
	height:28px;
	margin-right: 8px;
}
.apply-list-foot{
	font-size: 28rpx;
}
.personnel-list{
	display: flex;
	align-items: center;
	flex-wrap:wrap;
	.personnel-user{
		position: relative;
		margin: 5px 9px 0;
	}
	.user-images{
		width: 48px;
		height:48px;
		margin-right:0;
		
	}
	.iconfont{
		position: absolute;
		top:-12px;
		right:-5px;
		color: #FE0100;
	}
}
</style>
